package com.zhsm.fuxi.mvp.ui.adapter

import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.BaseViewHolder
import com.zhsm.fuxi.R
import com.zhsm.fuxi.app.Constant
import com.zhsm.fuxi.bean.CarInfoBean


/**
 * Created by GuZhC on 2018/11/7.
 * describe:
 */
class ChoseCarRecyclerAdapter(data: MutableList<CarInfoBean?>?) : BaseQuickAdapter<CarInfoBean, BaseViewHolder>(R.layout.layout_chosecar_detail, data) {
    override fun convert(helper: BaseViewHolder?, data: CarInfoBean?) {
        helper!!.setText(R.id.choseCarTitle, "${data!!.brand} ${data.series} ${data.year} ${data.gearbox} ${data.level}")
        helper.setText(R.id.choseCarIDNum, data.plate)
        helper.setText(R.id.choseCarEndurance, "${data.mileage}km")
        helper.setText(R.id.choseCarSeatNum, "${data.boxNum}箱 ${data.seatNum}座")
        helper.setText(R.id.choseCarExpend, "${data.capacity}")
        if (data.isSell == Constant.CAR.CAN_SELL) {
            helper.setVisible(R.id.choseCarMoney, true)
            helper.setVisible(R.id.choseCarHint, true)
            helper.setText(R.id.choseCarMoney,"可售：¥${data.sellingPrice}")
            helper.setText(R.id.choseCarHint,"${data.vehicleSlogan}")
        } else {
            helper.setVisible(R.id.choseCarMoney, false)
            helper.setVisible(R.id.choseCarHint, false)
        }

        helper.addOnClickListener(R.id.choseCarAdvertising)
    }
}